from django.db import models


class User(models.Model):
    # 用户id 主键
    user_id = models.AutoField(primary_key=True)
    # 用户名
    username = models.CharField(max_length=40)
    # 密码
    password = models.CharField(max_length=40)
    # 手机号
    phone = models.CharField(max_length=11, unique=True)
    # 性别
    sex = models.CharField(max_length=2, default="无")
    # 头像
    avatar = models.CharField(max_length=255, default="static/avatar.png")
    # 创建时间
    create_time = models.DateTimeField(auto_now_add=True)
    # 最后修改时间
    update_time = models.DateTimeField(auto_now=True)
    # 个性签名
    sign = models.CharField(max_length=255)


# 关注粉丝表
class Follow(models.Model):
    # 主键
    follow_id = models.AutoField(primary_key=True)
    # 用户id
    user_id = models.IntegerField()
    # 粉丝id
    fans_id = models.IntegerField()
    # 关注时间
    follow_time = models.DateTimeField(auto_now=True)
    # 是否互相关注
    mutual_follow = models.BooleanField(default=False)

